home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gcc_260.zip / gcc_260 / gcc.info-9 (.txt) < prev    next >
GNU Info File  |  1994-07-14  |  44KB  |  756 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: C++ Interface,  Next: C++ Signatures,  Prev: Destructors and Goto,  Up: C++ Extensions
  23. Declarations and Definitions in One Header
  24. ==========================================
  25.    C++ object definitions can be quite complex.  In principle, your
  26. source code will need two kinds of things for each object that you use
  27. across more than one source file.  First, you need an "interface"
  28. specification, describing its structure with type declarations and
  29. function prototypes.  Second, you need the "implementation" itself.  It
  30. can be tedious to maintain a separate interface description in a header
  31. file, in parallel to the actual implementation.  It is also dangerous,
  32. since separate interface and implementation definitions may not remain
  33. parallel.
  34.    With GNU C++, you can use a single header file for both purposes.
  35.      *Warning:* The mechanism to specify this is in transition.  For the
  36.      nonce, you must use one of two `#pragma' commands; in a future
  37.      release of GNU C++, an alternative mechanism will make these
  38.      `#pragma' commands unnecessary.
  39.    The header file contains the full definitions, but is marked with
  40. `#pragma interface' in the source code.  This allows the compiler to
  41. use the header file only as an interface specification when ordinary
  42. source files incorporate it with `#include'.  In the single source file
  43. where the full implementation belongs, you can use either a naming
  44. convention or `#pragma implementation' to indicate this alternate use
  45. of the header file.
  46. `#pragma interface'
  47.      Use this directive in *header files* that define object classes,
  48.      to save space in most of the object files that use those classes.
  49.      Normally, local copies of certain information (backup copies of
  50.      inline member functions, debugging information, and the internal
  51.      tables that implement virtual functions) must be kept in each
  52.      object file that includes class definitions.  You can use this
  53.      pragma to avoid such duplication.  When a header file containing
  54.      `#pragma interface' is included in a compilation, this auxiliary
  55.      information will not be generated (unless the main input source
  56.      file itself uses `#pragma implementation').  Instead, the object
  57.      files will contain references to be resolved at link time.
  58. `#pragma implementation'
  59. `#pragma implementation "OBJECTS.h"'
  60.      Use this pragma in a *main input file*, when you want full output
  61.      from included header files to be generated (and made globally
  62.      visible).  The included header file, in turn, should use `#pragma
  63.      interface'.  Backup copies of inline member functions, debugging
  64.      information, and the internal tables used to implement virtual
  65.      functions are all generated in implementation files.
  66.      `#pragma implementation' is *implied* whenever the basename(1) of
  67.      your source file matches the basename of a header file it
  68.      includes.  There is no way to turn this off (other than using a
  69.      different name for one of the two files).  In the same vein, if
  70.      you use `#pragma implementation' with no argument, it applies to an
  71.      include file with the same basename as your source file.  For
  72.      example, in `allclass.cc', `#pragma implementation' by itself is
  73.      equivalent to `#pragma implementation "allclass.h"'; but even if
  74.      you do not say `#pragma implementation' at all, `allclass.h' is
  75.      treated as an implementation file whenever you include it from
  76.      `allclass.cc'.
  77.      If you use an explicit `#pragma implementation', it must appear in
  78.      your source file *before* you include the affected header files.
  79.      Use the string argument if you want a single implementation file to
  80.      include code from multiple header files.  (You must also use
  81.      `#include' to include the header file; `#pragma implementation'
  82.      only specifies how to use the file--it doesn't actually include
  83.      it.)
  84.      There is no way to split up the contents of a single header file
  85.      into multiple implementation files.
  86.    `#pragma implementation' and `#pragma interface' also have an effect
  87. on function inlining.
  88.    If you define a class in a header file marked with `#pragma
  89. interface', the effect on a function defined in that class is similar to
  90. an explicit `extern' declaration--the compiler emits no code at all to
  91. define an independent version of the function.  Its definition is used
  92. only for inlining with its callers.
  93.    Conversely, when you include the same header file in a main source
  94. file that declares it as `#pragma implementation', the compiler emits
  95. code for the function itself; this defines a version of the function
  96. that can be found via pointers (or by callers compiled without
  97. inlining).
  98.    ---------- Footnotes ----------
  99.    (1)  A file's "basename" is the name stripped of all leading path
  100. information and of trailing suffixes, such as `.h' or `.C' or `.cc'.
  101. File: gcc.info,  Node: C++ Signatures,  Prev: C++ Interface,  Up: C++ Extensions
  102. Type Abstraction using Signatures
  103. =================================
  104.    In GNU C++, you can use the keyword `signature' to define a
  105. completely abstract class interface as a datatype.  You can connect this
  106. abstraction with actual classes using signature pointers.  If you want
  107. to use signatures, run the GNU compiler with the `-fhandle-signatures'
  108. command-line option.  (With this option, the compiler reserves a second
  109. keyword `sigof' as well, for a future extension.)
  110.    Roughly, signatures are type abstractions or interfaces of classes.
  111. Some other languages have similar facilities.  C++ signatures are
  112. related to ML's signatures, Haskell's type classes, definition modules
  113. in Modula-2, interface modules in Modula-3, abstract types in Emerald,
  114. type modules in Trellis/Owl, categories in Scratchpad II, and types in
  115. POOL-I.  For a more detailed discussion of signatures, see `Signatures:
  116. A C++ Extension for Type Abstraction and Subtype Polymorphism' by
  117. Gerald Baumgartner and Vincent F. Russo (Tech report CSD-TR-93-059,
  118. Dept. of Computer Sciences, Purdue University, September 1993, to
  119. appear in *Software Practice & Experience*).  You can get the tech
  120. report by anonymous FTP from `ftp.cs.purdue.edu' in
  121. `pub/reports/TR93-059.PS.Z'.
  122.    Syntactically, a signature declaration is a collection of member
  123. function declarations and nested type declarations.  For example, this
  124. signature declaration defines a new abstract type `S' with member
  125. functions `int foo ()' and `int bar (int)':
  126.      signature S
  127.      {
  128.        int foo ();
  129.        int bar (int);
  130.      };
  131.    Since signature types do not include implementation definitions, you
  132. cannot write an instance of a signature directly.  Instead, you can
  133. define a pointer to any class that contains the required interfaces as a
  134. "signature pointer".  Such a class "implements" the signature type.
  135.    To use a class as an implementation of `S', you must ensure that the
  136. class has public member functions `int foo ()' and `int bar (int)'.
  137. The class can have other member functions as well, public or not; as
  138. long as it offers what's declared in the signature, it is suitable as
  139. an implementation of that signature type.
  140.    For example, suppose that `C' is a class that meets the requirements
  141. of signature `S' (`C' "conforms to" `S').  Then
  142.      C obj;
  143.      S * p = &obj;
  144. defines a signature pointer `p' and initializes it to point to an
  145. object of type `C'.  The member function call `int i = p->foo ();'
  146. executes `obj.foo ()'.
  147.    Abstract virtual classes provide somewhat similar facilities in
  148. standard C++.  There are two main advantages to using signatures
  149. instead:
  150.   1. Subtyping becomes independent from inheritance.  A class or
  151.      signature type `T' is a subtype of a signature type `S'
  152.      independent of any inheritance hierarchy as long as all the member
  153.      functions declared in `S' are also found in `T'.  So you can
  154.      define a subtype hierarchy that is completely independent from any
  155.      inheritance (implementation) hierarchy, instead of being forced to
  156.      use types that mirror the class inheritance hierarchy.
  157.   2. Signatures allow you to work with existing class hierarchies as
  158.      implementations of a signature type.  If those class hierarchies
  159.      are only available in compiled form, you're out of luck with
  160.      abstract virtual classes, since an abstract virtual class cannot
  161.      be retrofitted on top of existing class hierarchies.  So you would
  162.      be required to write interface classes as subtypes of the abstract
  163.      virtual class.
  164.    There is one more detail about signatures.  A signature declaration
  165. can contain member function *definitions* as well as member function
  166. declarations.  A signature member function with a full definition is
  167. called a *default implementation*; classes need not contain that
  168. particular interface in order to conform.  For example, a class `C' can
  169. conform to the signature
  170.      signature T
  171.      {
  172.        int f (int);
  173.        int f0 () { return f (0); };
  174.      };
  175. whether or not `C' implements the member function `int f0 ()'.  If you
  176. define `C::f0', that definition takes precedence; otherwise, the
  177. default implementation `S::f0' applies.
  178. File: gcc.info,  Node: Trouble,  Next: Bugs,  Prev: C++ Extensions,  Up: Top
  179. Known Causes of Trouble with GNU CC
  180. ***********************************
  181.    This section describes known problems that affect users of GNU CC.
  182. Most of these are not GNU CC bugs per se--if they were, we would fix
  183. them.  But the result for a user may be like the result of a bug.
  184.    Some of these problems are due to bugs in other software, some are
  185. missing features that are too much work to add, and some are places
  186. where people's opinions differ as to what is best.
  187. * Menu:
  188. * Actual Bugs::              Bugs we will fix later.
  189. * Installation Problems::     Problems that manifest when you install GNU CC.
  190. * Cross-Compiler Problems::   Common problems of cross compiling with GNU CC.
  191. * Interoperation::      Problems using GNU CC with other compilers,
  192.                and with certain linkers, assemblers and debuggers.
  193. * External Bugs::    Problems compiling certain programs.
  194. * Incompatibilities::   GNU CC is incompatible with traditional C.
  195. * Fixed Headers::       GNU C uses corrected versions of system header files.
  196.                            This is necessary, but doesn't always work smoothly.
  197. * Disappointments::     Regrettable things we can't change, but not quite bugs.
  198. * C++ Misunderstandings::     Common misunderstandings with GNU C++.
  199. * Protoize Caveats::    Things to watch out for when using `protoize'.
  200. * Non-bugs::        Things we think are right, but some others disagree.
  201. * Warnings and Errors:: Which problems in your code get warnings,
  202.                          and which get errors.
  203. File: gcc.info,  Node: Actual Bugs,  Next: Installation Problems,  Up: Trouble
  204. Actual Bugs We Haven't Fixed Yet
  205. ================================
  206.    * The `fixincludes' script interacts badly with automounters; if the
  207.      directory of system header files is automounted, it tends to be
  208.      unmounted while `fixincludes' is running.  This would seem to be a
  209.      bug in the automounter.  We don't know any good way to work around
  210.      it.
  211.    * The `fixproto' script will sometimes add prototypes for the
  212.      `sigsetjmp' and `siglongjmp' functions that reference the
  213.      `jmp_buf' type before that type is defined.  To work around this,
  214.      edit the offending file and place the typedef in front of the
  215.      prototypes.
  216.    * Loop unrolling doesn't work properly for certain C++ programs.
  217.      This is because of difficulty in updating the debugging
  218.      information within the loop being unrolled.  We plan to revamp the
  219.      representation of debugging information so that this will work
  220.      properly, but we have not done this in version 2.6 because we
  221.      don't want to delay it any further.
  222. File: gcc.info,  Node: Installation Problems,  Next: Cross-Compiler Problems,  Prev: Actual Bugs,  Up: Trouble
  223. Installation Problems
  224. =====================
  225.    This is a list of problems (and some apparent problems which don't
  226. really mean anything is wrong) that show up during installation of GNU
  227.    * On certain systems, defining certain environment variables such as
  228.      `CC' can interfere with the functioning of `make'.
  229.    * If you encounter seemingly strange errors when trying to build the
  230.      compiler in a directory other than the source directory, it could
  231.      be because you have previously configured the compiler in the
  232.      source directory.  Make sure you have done all the necessary
  233.      preparations.  *Note Other Dir::.
  234.    * If you build GNU CC on a BSD system using a directory stored in a
  235.      System V file system, problems may occur in running `fixincludes'
  236.      if the System V file system doesn't support symbolic links.  These
  237.      problems result in a failure to fix the declaration of `size_t' in
  238.      `sys/types.h'.  If you find that `size_t' is a signed type and
  239.      that type mismatches occur, this could be the cause.
  240.      The solution is not to use such a directory for building GNU CC.
  241.    * In previous versions of GNU CC, the `gcc' driver program looked for
  242.      `as' and `ld' in various places; for example, in files beginning
  243.      with `/usr/local/lib/gcc-'.  GNU CC version 2 looks for them in
  244.      the directory `/usr/local/lib/gcc-lib/TARGET/VERSION'.
  245.      Thus, to use a version of `as' or `ld' that is not the system
  246.      default, for example `gas' or GNU `ld', you must put them in that
  247.      directory (or make links to them from that directory).
  248.    * Some commands executed when making the compiler may fail (return a
  249.      non-zero status) and be ignored by `make'.  These failures, which
  250.      are often due to files that were not found, are expected, and can
  251.      safely be ignored.
  252.    * It is normal to have warnings in compiling certain files about
  253.      unreachable code and about enumeration type clashes.  These files'
  254.      names begin with `insn-'.  Also, `real.c' may get some warnings
  255.      that you can ignore.
  256.    * Sometimes `make' recompiles parts of the compiler when installing
  257.      the compiler.  In one case, this was traced down to a bug in
  258.      `make'.  Either ignore the problem or switch to GNU Make.
  259.    * If you have installed a program known as purify, you may find that
  260.      it causes errors while linking `enquire', which is part of building
  261.      GNU CC.  The fix is to get rid of the file `real-ld' which purify
  262.      installs--so that GNU CC won't try to use it.
  263.    * On Linux SLS 1.01, there is a problem with `libc.a': it does not
  264.      contain the obstack functions.  However, GNU CC assumes that the
  265.      obstack functions are in `libc.a' when it is the GNU C library.
  266.      To work around this problem, change the `__GNU_LIBRARY__'
  267.      conditional around line 31 to `#if 1'.
  268.    * On some 386 systems, building the compiler never finishes because
  269.      `enquire' hangs due to a hardware problem in the motherboard--it
  270.      reports floating point exceptions to the kernel incorrectly.  You
  271.      can install GNU CC except for `float.h' by patching out the
  272.      command to run `enquire'.  You may also be able to fix the problem
  273.      for real by getting a replacement motherboard.  This problem was
  274.      observed in Revision E of the Micronics motherboard, and is fixed
  275.      in Revision F.  It has also been observed in the MYLEX MXA-33
  276.      motherboard.
  277.      If you encounter this problem, you may also want to consider
  278.      removing the FPU from the socket during the compilation.
  279.      Alternatively, if you are running SCO Unix, you can reboot and
  280.      force the FPU to be ignored.  To do this, type `hd(40)unix auto
  281.      ignorefpu'.
  282.    * On some 386 systems, GNU CC crashes trying to compile `enquire.c'.
  283.      This happens on machines that don't have a 387 FPU chip.  On 386
  284.      machines, the system kernel is supposed to emulate the 387 when you
  285.      don't have one.  The crash is due to a bug in the emulator.
  286.      One of these systems is the Unix from Interactive Systems: 386/ix.
  287.      On this system, an alternate emulator is provided, and it does
  288.      work.  To use it, execute this command as super-user:
  289.           ln /etc/emulator.rel1 /etc/emulator
  290.      and then reboot the system.  (The default emulator file remains
  291.      present under the name `emulator.dflt'.)
  292.      Try using `/etc/emulator.att', if you have such a problem on the
  293.      SCO system.
  294.      Another system which has this problem is Esix.  We don't know
  295.      whether it has an alternate emulator that works.
  296.      On NetBSD 0.8, a similar problem manifests itself as these error
  297.      messages:
  298.           enquire.c: In function `fprop':
  299.           enquire.c:2328: floating overflow
  300.    * On SCO systems, when compiling GNU CC with the system's compiler,
  301.      do not use `-O'.  Some versions of the system's compiler miscompile
  302.      GNU CC with `-O'.
  303.    * Sometimes on a Sun 4 you may observe a crash in the program
  304.      `genflags' or `genoutput' while building GNU CC.  This is said to
  305.      be due to a bug in `sh'.  You can probably get around it by running
  306.      `genflags' or `genoutput' manually and then retrying the `make'.
  307.    * On Solaris 2, executables of GNU CC version 2.0.2 are commonly
  308.      available, but they have a bug that shows up when compiling current
  309.      versions of GNU CC: undefined symbol errors occur during assembly
  310.      if you use `-g'.
  311.      The solution is to compile the current version of GNU CC without
  312.      `-g'.  That makes a working compiler which you can use to recompile
  313.      with `-g'.
  314.    * Solaris 2 comes with a number of optional OS packages.  Some of
  315.      these packages are needed to use GNU CC fully.  If you did not
  316.      install all optional packages when installing Solaris, you will
  317.      need to verify that the packages that GNU CC needs are installed.
  318.      To check whether an optional package is installed, use the
  319.      `pkginfo' command.  To add an optional package, use the `pkgadd'
  320.      command.  For further details, see the Solaris documentation.
  321.      For Solaris 2.0 and 2.1, GNU CC needs six packages: `SUNWarc',
  322.      `SUNWbtool', `SUNWesu', `SUNWhea', `SUNWlibm', and `SUNWtoo'.
  323.      For Solaris 2.2, GNU CC needs an additional seventh package:
  324.      `SUNWsprot'.
  325.    * On Solaris 2, trying to use the linker and other tools in
  326.      `/usr/ucb' to install GNU CC has been observed to cause trouble.
  327.      For example, the linker may hang indefinitely.  The fix is to
  328.      remove `/usr/ucb' from your `PATH'.
  329.    * If you use the 1.31 version of the MIPS assembler (such as was
  330.      shipped with Ultrix 3.1), you will need to use the
  331.      -fno-delayed-branch switch when optimizing floating point code.
  332.      Otherwise, the assembler will complain when the GCC compiler fills
  333.      a branch delay slot with a floating point instruction, such as
  334.      `add.d'.
  335.    * If on a MIPS system you get an error message saying "does not have
  336.      gp sections for all it's [sic] sectons [sic]", don't worry about
  337.      it.  This happens whenever you use GAS with the MIPS linker, but
  338.      there is not really anything wrong, and it is okay to use the
  339.      output file.  You can stop such warnings by installing the GNU
  340.      linker.
  341.      It would be nice to extend GAS to produce the gp tables, but they
  342.      are optional, and there should not be a warning about their
  343.      absence.
  344.    * In Ultrix 4.0 on the MIPS machine, `stdio.h' does not work with GNU
  345.      CC at all unless it has been fixed with `fixincludes'.  This causes
  346.      problems in building GNU CC.  Once GNU CC is installed, the
  347.      problems go away.
  348.      To work around this problem, when making the stage 1 compiler,
  349.      specify this option to Make:
  350.           GCC_FOR_TARGET="./xgcc -B./ -I./include"
  351.      When making stage 2 and stage 3, specify this option:
  352.           CFLAGS="-g -I./include"
  353.    * Users have reported some problems with version 2.0 of the MIPS
  354.      compiler tools that were shipped with Ultrix 4.1.  Version 2.10
  355.      which came with Ultrix 4.2 seems to work fine.
  356.      Users have also reported some problems with version 2.20 of the
  357.      MIPS compiler tools that were shipped with RISC/os 4.x.  The
  358.      earlier version 2.11 seems to work fine.
  359.    * Some versions of the MIPS linker will issue an assertion failure
  360.      when linking code that uses `alloca' against shared libraries on
  361.      RISC-OS 5.0, and DEC's OSF/1 systems.  This is a bug in the
  362.      linker, that is supposed to be fixed in future revisions.  To
  363.      protect against this, GNU CC passes `-non_shared' to the linker
  364.      unless you pass an explicit `-shared' or `-call_shared' switch.
  365.    * On System V release 3, you may get this error message while
  366.      linking:
  367.           ld fatal: failed to write symbol name SOMETHING
  368.            in strings table for file WHATEVER
  369.      This probably indicates that the disk is full or your ULIMIT won't
  370.      allow the file to be as large as it needs to be.
  371.      This problem can also result because the kernel parameter `MAXUMEM'
  372.      is too small.  If so, you must regenerate the kernel and make the
  373.      value much larger.  The default value is reported to be 1024; a
  374.      value of 32768 is said to work.  Smaller values may also work.
  375.    * On System V, if you get an error like this,
  376.           /usr/local/lib/bison.simple: In function `yyparse':
  377.           /usr/local/lib/bison.simple:625: virtual memory exhausted
  378.      that too indicates a problem with disk space, ULIMIT, or `MAXUMEM'.
  379.    * Current GNU CC versions probably do not work on version 2 of the
  380.      NeXT operating system.
  381.    * On NeXTStep 3.0, the Objective C compiler does not work, due,
  382.      apparently, to a kernel bug that it happens to trigger.  This
  383.      problem does not happen on 3.1.
  384.    * On the Tower models 4N0 and 6N0, by default a process is not
  385.      allowed to have more than one megabyte of memory.  GNU CC cannot
  386.      compile itself (or many other programs) with `-O' in that much
  387.      memory.
  388.      To solve this problem, reconfigure the kernel adding the following
  389.      line to the configuration file:
  390.           MAXUMEM = 4096
  391.    * On HP 9000 series 300 or 400 running HP-UX release 8.0, there is a
  392.      bug in the assembler that must be fixed before GNU CC can be
  393.      built.  This bug manifests itself during the first stage of
  394.      compilation, while building `libgcc2.a':
  395.           _floatdisf
  396.           cc1: warning: `-g' option not supported on this version of GCC
  397.           cc1: warning: `-g1' option not supported on this version of GCC
  398.           ./xgcc: Internal compiler error: program as got fatal signal 11
  399.      A patched version of the assembler is available by anonymous ftp
  400.      from `altdorf.ai.mit.edu' as the file
  401.      `archive/cph/hpux-8.0-assembler'.  If you have HP software support,
  402.      the patch can also be obtained directly from HP, as described in
  403.      the following note:
  404.           This is the patched assembler, to patch SR#1653-010439, where
  405.           the assembler aborts on floating point constants.
  406.           The bug is not really in the assembler, but in the shared
  407.           library version of the function "cvtnum(3c)".  The bug on
  408.           "cvtnum(3c)" is SR#4701-078451.  Anyway, the attached
  409.           assembler uses the archive library version of "cvtnum(3c)"
  410.           and thus does not exhibit the bug.
  411.      This patch is also known as PHCO_0800.
  412.    * On HP-UX version 8.05, but not on 8.07 or more recent versions,
  413.      the `fixproto' shell script triggers a bug in the system shell.
  414.      If you encounter this problem, upgrade your operating system or
  415.      use BASH (the GNU shell) to run `fixproto'.
  416.    * Some versions of the Pyramid C compiler are reported to be unable
  417.      to compile GNU CC.  You must use an older version of GNU CC for
  418.      bootstrapping.  One indication of this problem is if you get a
  419.      crash when GNU CC compiles the function `muldi3' in file
  420.      `libgcc2.c'.
  421.      You may be able to succeed by getting GNU CC version 1, installing
  422.      it, and using it to compile GNU CC version 2.  The bug in the
  423.      Pyramid C compiler does not seem to affect GNU CC version 1.
  424.    * There may be similar problems on System V Release 3.1 on 386
  425.      systems.
  426.    * On the Intel Paragon (an i860 machine), if you are using operating
  427.      system version 1.0, you will get warnings or errors about
  428.      redefinition of `va_arg' when you build GNU CC.
  429.      If this happens, then you need to link most programs with the
  430.      library `iclib.a'.  You must also modify `stdio.h' as follows:
  431.      before the lines
  432.           #if     defined(__i860__) && !defined(_VA_LIST)
  433.           #include <va_list.h>
  434.      insert the line
  435.           #if __PGC__
  436.      and after the lines
  437.           extern int  vprintf(const char *, va_list );
  438.           extern int  vsprintf(char *, const char *, va_list );
  439.           #endif
  440.      insert the line
  441.           #endif /* __PGC__ */
  442.      These problems don't exist in operating system version 1.1.
  443.    * On the Altos 3068, programs compiled with GNU CC won't work unless
  444.      you fix a kernel bug.  This happens using system versions V.2.2
  445.      1.0gT1 and V.2.2 1.0e and perhaps later versions as well.  See the
  446.      file `README.ALTOS'.
  447.    * You will get several sorts of compilation and linking errors on the
  448.      we32k if you don't follow the special instructions.  *Note
  449.      Configurations::.
  450.    * A bug in the HP-UX 8.05 (and earlier) shell will cause the fixproto
  451.      program to report an error of the form:
  452.           ./fixproto: sh internal 1K buffer overflow
  453.      To fix this, change the first line of the fixproto script to look
  454.      like:
  455.           #!/bin/ksh
  456. File: gcc.info,  Node: Cross-Compiler Problems,  Next: Interoperation,  Prev: Installation Problems,  Up: Trouble
  457. Cross-Compiler Problems
  458. =======================
  459.    You may run into problems with cross compilation on certain machines,
  460. for several reasons.
  461.    * Cross compilation can run into trouble for certain machines because
  462.      some target machines' assemblers require floating point numbers to
  463.      be written as *integer* constants in certain contexts.
  464.      The compiler writes these integer constants by examining the
  465.      floating point value as an integer and printing that integer,
  466.      because this is simple to write and independent of the details of
  467.      the floating point representation.  But this does not work if the
  468.      compiler is running on a different machine with an incompatible
  469.      floating point format, or even a different byte-ordering.
  470.      In addition, correct constant folding of floating point values
  471.      requires representing them in the target machine's format.  (The C
  472.      standard does not quite require this, but in practice it is the
  473.      only way to win.)
  474.      It is now possible to overcome these problems by defining macros
  475.      such as `REAL_VALUE_TYPE'.  But doing so is a substantial amount of
  476.      work for each target machine.  *Note Cross-compilation::.
  477.    * At present, the program `mips-tfile' which adds debug support to
  478.      object files on MIPS systems does not work in a cross compile
  479.      environment.
  480. File: gcc.info,  Node: Interoperation,  Next: External Bugs,  Prev: Cross-Compiler Problems,  Up: Trouble
  481. Interoperation
  482. ==============
  483.    This section lists various difficulties encountered in using GNU C or
  484. GNU C++ together with other compilers or with the assemblers, linkers,
  485. libraries and debuggers on certain systems.
  486.    * Objective C does not work on the RS/6000.
  487.    * GNU C++ does not do name mangling in the same way as other C++
  488.      compilers.  This means that object files compiled with one compiler
  489.      cannot be used with another.
  490.      This effect is intentional, to protect you from more subtle
  491.      problems.  Compilers differ as to many internal details of C++
  492.      implementation, including: how class instances are laid out, how
  493.      multiple inheritance is implemented, and how virtual function
  494.      calls are handled.  If the name encoding were made the same, your
  495.      programs would link against libraries provided from other
  496.      compilers--but the programs would then crash when run.
  497.      Incompatible libraries are then detected at link time, rather than
  498.      at run time.
  499.    * Older GDB versions sometimes fail to read the output of GNU CC
  500.      version 2.  If you have trouble, get GDB version 4.4 or later.
  501.    * DBX rejects some files produced by GNU CC, though it accepts
  502.      similar constructs in output from PCC.  Until someone can supply a
  503.      coherent description of what is valid DBX input and what is not,
  504.      there is nothing I can do about these problems.  You are on your
  505.      own.
  506.    * The GNU assembler (GAS) does not support PIC.  To generate PIC
  507.      code, you must use some other assembler, such as `/bin/as'.
  508.    * On some BSD systems, including some versions of Ultrix, use of
  509.      profiling causes static variable destructors (currently used only
  510.      in C++) not to be run.
  511.    * Use of `-I/usr/include' may cause trouble.
  512.      Many systems come with header files that won't work with GNU CC
  513.      unless corrected by `fixincludes'.  The corrected header files go
  514.      in a new directory; GNU CC searches this directory before
  515.      `/usr/include'.  If you use `-I/usr/include', this tells GNU CC to
  516.      search `/usr/include' earlier on, before the corrected headers.
  517.      The result is that you get the uncorrected header files.
  518.      Instead, you should use these options (when compiling C programs):
  519.           -I/usr/local/lib/gcc-lib/TARGET/VERSION/include -I/usr/include
  520.      For C++ programs, GNU CC also uses a special directory that
  521.      defines C++ interfaces to standard C subroutines.  This directory
  522.      is meant to be searched *before* other standard include
  523.      directories, so that it takes precedence.  If you are compiling
  524.      C++ programs and specifying include directories explicitly, use
  525.      this option first, then the two options above:
  526.           -I/usr/local/lib/g++-include
  527.    * On some SGI systems, when you use `-lgl_s' as an option, it gets
  528.      translated magically to `-lgl_s -lX11_s -lc_s'.  Naturally, this
  529.      does not happen when you use GNU CC.  You must specify all three
  530.      options explicitly.
  531.    * On a Sparc, GNU CC aligns all values of type `double' on an 8-byte
  532.      boundary, and it expects every `double' to be so aligned.  The Sun
  533.      compiler usually gives `double' values 8-byte alignment, with one
  534.      exception: function arguments of type `double' may not be aligned.
  535.      As a result, if a function compiled with Sun CC takes the address
  536.      of an argument of type `double' and passes this pointer of type
  537.      `double *' to a function compiled with GNU CC, dereferencing the
  538.      pointer may cause a fatal signal.
  539.      One way to solve this problem is to compile your entire program
  540.      with GNU CC.  Another solution is to modify the function that is
  541.      compiled with Sun CC to copy the argument into a local variable;
  542.      local variables are always properly aligned.  A third solution is
  543.      to modify the function that uses the pointer to dereference it via
  544.      the following function `access_double' instead of directly with
  545.      `*':
  546.           inline double
  547.           access_double (double *unaligned_ptr)
  548.           {
  549.             union d2i { double d; int i[2]; };
  550.           
  551.             union d2i *p = (union d2i *) unaligned_ptr;
  552.             union d2i u;
  553.           
  554.             u.i[0] = p->i[0];
  555.             u.i[1] = p->i[1];
  556.           
  557.             return u.d;
  558.           }
  559.      Storing into the pointer can be done likewise with the same union.
  560.    * On Solaris, the `malloc' function in the `libmalloc.a' library may
  561.      allocate memory that is only 4 byte aligned.  Since GNU CC on the
  562.      Sparc assumes that doubles are 8 byte aligned, this may result in a
  563.      fatal signal if doubles are stored in memory allocated by the
  564.      `libmalloc.a' library.
  565.      The solution is to not use the `libmalloc.a' library.  Use instead
  566.      `malloc' and related functions from `libc.a'; they do not have
  567.      this problem.
  568.    * On a Sun, linking using GNU CC fails to find a shared library and
  569.      reports that the library doesn't exist at all.
  570.      This happens if you are using the GNU linker, because it does only
  571.      static linking and looks only for unshared libraries.  If you have
  572.      a shared library with no unshared counterpart, the GNU linker
  573.      won't find anything.
  574.      We hope to make a linker which supports Sun shared libraries, but
  575.      please don't ask when it will be finished--we don't know.
  576.    * Sun forgot to include a static version of `libdl.a' with some
  577.      versions of SunOS (mainly 4.1).  This results in undefined symbols
  578.      when linking static binaries (that is, if you use `-static').  If
  579.      you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when
  580.      linking, compile and link against the file `mit/util/misc/dlsym.c'
  581.      from the MIT version of X windows.
  582.    * The 128-bit long double format that the Sparc port supports
  583.      currently works by using the architecturally defined quad-word
  584.      floating point instructions.  Since there is no hardware that
  585.      supports these instructions they must be emulated by the operating
  586.      system.  Long doubles do not work in Sun OS versions 4.0.3 and
  587.      earlier, because the kernel eumulator uses an obsolete and
  588.      incompatible format.  Long doubles do not work in Sun OS versions
  589.      4.1.1 to 4.1.3 because of emululator bugs that cause random
  590.      unpredicatable failures.  Long doubles appear to work in Sun OS 5.x
  591.      (Solaris 2.x).
  592.    * On HP-UX version 9.01 on the HP PA, the HP compiler `cc' does not
  593.      compile GNU CC correctly.  We do not yet know why.  However, GNU CC
  594.      compiled on earlier HP-UX versions works properly on HP-UX 9.01
  595.      and can compile itself properly on 9.01.
  596.    * On the HP PA machine, ADB sometimes fails to work on functions
  597.      compiled with GNU CC.  Specifically, it fails to work on functions
  598.      that use `alloca' or variable-size arrays.  This is because GNU CC
  599.      doesn't generate HP-UX unwind descriptors for such functions.  It
  600.      may even be impossible to generate them.
  601.    * Debugging (`-g') is not supported on the HP PA machine, unless you
  602.      use the preliminary GNU tools (*note Installation::.).
  603.    * Taking the address of a label may generate errors from the HP-UX
  604.      PA assembler.  GAS for the PA does not have this problem.
  605.    * Using floating point parameters for indirect calls to static
  606.      functions will not work when using the HP assembler.  There simply
  607.      is no way for GCC to specify what registers hold arguments for
  608.      static functions when using the HP assembler.  GAS for the PA does
  609.      not have this problem.
  610.    * For some very large functions you may receive errors from the HP
  611.      linker complaining about an out of bounds unconditional branch
  612.      offset.  Fixing this problem correctly requires fixing problems in
  613.      GNU CC and GAS.  We hope to fix this in time for GNU CC 2.6.
  614.      Until then you can work around by making your function smaller,
  615.      and if you are using GAS, splitting the function into multiple
  616.      source files may be necessary.
  617.    * GNU CC compiled code sometimes emits warnings from the HP-UX
  618.      assembler of the form:
  619.           (warning) Use of GR3 when
  620.             frame >= 8192 may cause conflict.
  621.      These warnings are harmless and can be safely ignored.
  622.    * The current version of the assembler (`/bin/as') for the RS/6000
  623.      has certain problems that prevent the `-g' option in GCC from
  624.      working.  Note that `Makefile.in' uses `-g' by default when
  625.      compiling `libgcc2.c'.
  626.      IBM has produced a fixed version of the assembler.  The upgraded
  627.      assembler unfortunately was not included in any of the AIX 3.2
  628.      update PTF releases (3.2.2, 3.2.3, or 3.2.3e).  Users of AIX 3.1
  629.      should request PTF U403044 from IBM and users of AIX 3.2 should
  630.      request PTF U416277.  See the file `README.RS6000' for more
  631.      details on these updates.
  632.      You can test for the presense of a fixed assembler by using the
  633.      command
  634.           as -u < /dev/null
  635.      If the command exits normally, the assembler fix already is
  636.      installed.  If the assembler complains that "-u" is an unknown
  637.      flag, you need to order the fix.
  638.    * On the IBM RS/6000, compiling code of the form
  639.           extern int foo;
  640.           
  641.           ... foo ...
  642.           
  643.           static int foo;
  644.      will cause the linker to report an undefined symbol `foo'.
  645.      Although this behavior differs from most other systems, it is not a
  646.      bug because redefining an `extern' variable as `static' is
  647.      undefined in ANSI C.
  648.    * AIX on the RS/6000 provides support (NLS) for environments outside
  649.      of the United States.  Compilers and assemblers use NLS to support
  650.      locale-specific representations of various objects including
  651.      floating-point numbers ("." vs "," for separating decimal
  652.      fractions).  There have been problems reported where the library
  653.      linked with GCC does not produce the same floating-point formats
  654.      that the assembler accepts.  If you have this problem, set the
  655.      LANG environment variable to "C" or "En_US".
  656.    * Even if you specify `-fdollars-in-identifiers', you cannot
  657.      successfully use `$' in identifiers on the RS/6000 due to a
  658.      restriction in the IBM assembler.  GAS supports these identifiers.
  659.    * On the RS/6000, XLC version 1.3.0.0 will miscompile `jump.c'.  XLC
  660.      version 1.3.0.1 or later fixes this problem.  You can obtain
  661.      XLC-1.3.0.2 by requesting PTF 421749 from IBM.
  662.    * There is an assembler bug in versions of DG/UX prior to 5.4.2.01
  663.      that occurs when the `fldcr' instruction is used.  GNU CC uses
  664.      `fldcr' on the 88100 to serialize volatile memory references.  Use
  665.      the option `-mno-serialize-volatile' if your version of the
  666.      assembler has this bug.
  667.    * On VMS, GAS versions 1.38.1 and earlier may cause spurious warning
  668.      messages from the linker.  These warning messages complain of
  669.      mismatched psect attributes.  You can ignore them.  *Note VMS
  670.      Install::.
  671.    * On NewsOS version 3, if you include both of the files `stddef.h'
  672.      and `sys/types.h', you get an error because there are two typedefs
  673.      of `size_t'.  You should change `sys/types.h' by adding these
  674.      lines around the definition of `size_t':
  675.           #ifndef _SIZE_T
  676.           #define _SIZE_T
  677.           ACTUAL TYPEDEF HERE
  678.           #endif
  679.    * On the Alliant, the system's own convention for returning
  680.      structures and unions is unusual, and is not compatible with GNU
  681.      CC no matter what options are used.
  682.    * On the IBM RT PC, the MetaWare HighC compiler (hc) uses a different
  683.      convention for structure and union returning.  Use the option
  684.      `-mhc-struct-return' to tell GNU CC to use a convention compatible
  685.      with it.
  686.    * On Ultrix, the Fortran compiler expects registers 2 through 5 to
  687.      be saved by function calls.  However, the C compiler uses
  688.      conventions compatible with BSD Unix: registers 2 through 5 may be
  689.      clobbered by function calls.
  690.      GNU CC uses the same convention as the Ultrix C compiler.  You can
  691.      use these options to produce code compatible with the Fortran
  692.      compiler:
  693.           -fcall-saved-r2 -fcall-saved-r3 -fcall-saved-r4 -fcall-saved-r5
  694.    * On the WE32k, you may find that programs compiled with GNU CC do
  695.      not work with the standard shared C ilbrary.  You may need to link
  696.      with the ordinary C compiler.  If you do so, you must specify the
  697.      following options:
  698.           -L/usr/local/lib/gcc-lib/we32k-att-sysv/2.6.0 -lgcc -lc_s
  699.      The first specifies where to find the library `libgcc.a' specified
  700.      with the `-lgcc' option.
  701.      GNU CC does linking by invoking `ld', just as `cc' does, and there
  702.      is no reason why it *should* matter which compilation program you
  703.      use to invoke `ld'.  If someone tracks this problem down, it can
  704.      probably be fixed easily.
  705.    * On the Alpha, you may get assembler errors about invalid syntax as
  706.      a result of floating point constants.  This is due to a bug in the
  707.      C library functions `ecvt', `fcvt' and `gcvt'.  Given valid
  708.      floating point numbers, they sometimes print `NaN'.
  709.    * On Irix 4.0.5F (and perhaps in some other versions), an assembler
  710.      bug sometimes reorders instructions incorrectly when optimization
  711.      is turned on.  If you think this may be happening to you, try
  712.      using the GNU assembler; GAS version 2.1 supports ECOFF on Irix.
  713.      Or use the `-noasmopt' option when you compile GNU CC with itself,
  714.      and then again when you compile your program.  (This is a temporary
  715.      kludge to turn off assembler optimization on Irix.)  If this
  716.      proves to be what you need, edit the assembler spec in the file
  717.      `specs' so that it unconditionally passes `-O0' to the assembler,
  718.      and never passes `-O2' or `-O3'.
  719. File: gcc.info,  Node: External Bugs,  Next: Incompatibilities,  Prev: Interoperation,  Up: Trouble
  720. Problems Compiling Certain Programs
  721. ===================================
  722.    * Parse errors may occur compiling X11 on a Decstation running
  723.      Ultrix 4.2 because of problems in DEC's versions of the X11 header
  724.      files `X11/Xlib.h' and `X11/Xutil.h'.  People recommend adding
  725.      `-I/usr/include/mit' to use the MIT versions of the header files,
  726.      using the `-traditional' switch to turn off ANSI C, or fixing the
  727.      header files by adding this:
  728.           #ifdef __STDC__
  729.           #define NeedFunctionPrototypes 0
  730.           #endif
  731.    * If you have trouble compiling Perl on a SunOS 4 system, it may be
  732.      because Perl specifies `-I/usr/ucbinclude'.  This accesses the
  733.      unfixed header files.  Perl specifies the options
  734.           -traditional -Dvolatile=__volatile__
  735.           -I/usr/include/sun -I/usr/ucbinclude
  736.           -fpcc-struct-return
  737.      most of which are unnecessary with GCC 2.4.5 and newer versions.
  738.      You can make a properly working Perl by setting `ccflags' to
  739.      `-fwritable-strings' (implied by the `-traditional' in the
  740.      original options) and `cppflags' to empty in `config.sh', then
  741.      typing `./doSH; make depend; make'.
  742.    * On various 386 Unix systems derived from System V, including SCO,
  743.      ISC, and ESIX, you may get error messages about running out of
  744.      virtual memory while compiling certain programs.
  745.      You can prevent this problem by linking GNU CC with the GNU malloc
  746.      (which thus replaces the malloc that comes with the system).  GNU
  747.      malloc is available as a separate package, and also in the file
  748.      `src/gmalloc.c' in the GNU Emacs 19 distribution.
  749.      If you have installed GNU malloc as a separate library package,
  750.      use this option when you relink GNU CC:
  751.           MALLOC=/usr/local/lib/libgmalloc.a
  752.      Alternatively, if you have compiled `gmalloc.c' from Emacs 19, copy
  753.      the object file to `gmalloc.o' and use this option when you relink
  754.      GNU CC:
  755.           MALLOC=gmalloc.o
  756.